require 'pyro/app'

# Public: Basic pyro actions.
#
# Example
#
#   Pyro.burn
module Pyro
  # Public: Builds an app for production.
  #
  # Example
  #
  #   Pyro.burn
  #
  # Writes a minified production build to /public.
  def self.burn
    ENV['RACK_ENV'] = 'production'
    Pyro::App.set :environment, :production
    Pyro::App.new.helpers.render()
    Pyro::App.new.helpers.minify()
  end

  # Public: Runs an app on localhost:7976.
  #
  # env - The environment to run on, defaults to development.
  #
  # Example
  #
  #   Pyro.serve(env='test')
  #
  # Runs an app on a local server.
  def self.serve(env)
    ENV['RACK_ENV'] = env
    Pyro::App.set :environment, env.to_sym
    Pyro::App.run!
  end
end